<%@ page language="java" import="java.util.*,com.hs.core.utils.*,com.hs.chd.action.search.*" pageEncoding="utf-8"%>
<%
String dbtype = (String)request.getAttribute("dbtype");
String disidstr = (String)request.getAttribute("disidstr"); 
String paramvalue = (String)request.getAttribute("paramvalue"); 
disidstr = disidstr == null?"":disidstr;
paramvalue = paramvalue == null?"":paramvalue;
 %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head> 
<%@ include file="../../include.jsp"%> 
<script src='<%=basePath%>thirtpart/jquery/jquery.blockUI.js'></script> 
<script src='<%=basePath%>app/js/hs.search.js'></script> 
<link rel="stylesheet" type="text/css" href="<%=basePath %>thirtpart/dhtmlx25/dhtmlxlayout.css"/>
<link rel="STYLESHEET" type="text/css" href="<%=basePath %>thirtpart/dhtmlx25/dhtmlxtree.css"/>
<link rel="stylesheet" type="text/css" href="<%=basePath %>thirtpart/dhtmlx25/skins/dhtmlxlayout_dhx_blue.css"/>
<script src="<%=basePath %>thirtpart/dhtmlx25/dhtmlxcommon.js"></script>
<script src="<%=basePath %>thirtpart/dhtmlx25/dhtmlxlayout.js"></script> 
<script src="<%=basePath %>thirtpart/dhtmlx25/dhtmlxcontainer.js"></script>  
<script  src="<%=basePath %>thirtpart/dhtmlx25/dhtmlxtree.js"></script>  
<style>.tac{text-align:center}</style>
<script language=JavaScript> 
function datastat(){
	//var win = document.getElementById('resultlist').contentWindow;
	//var allsql = win.document.getElementById('allfullsql').value;
    //openwindow('<%=basePath%>stat/statindex.do?allsql='+encodeURI(allsql),'1280','960','');
	basiclinchuang('','','<%=basePath %>');
}
function datastatadv(){
	//var win = document.getElementById('resultlist').contentWindow;
	//var allsql = win.document.getElementById('allfullsql').value;
    //openwindow('<%=basePath%>stat/statindex.do?allsql='+encodeURI(allsql),'1280','960','');
	advlinchuang('','<%=basePath %>');
}
function returnIndex(){
  window.parent.cont.frameElement.src="<%=basePath%>search/index.do";  
}
function resetAllInput(){
     
 	var   obj   =   document.all.tags("input"); 
	for(i=0;i <obj.length;i++){ 
	    if(obj[i].type== "text"){ 
	            obj[i].value   =   ""; 
	    } 
	}
}
</script>
</head>
<body>
<dl class="treeWrap">
    <dt> <input type="button" onclick="selectAll();" value="全选" class="btn btn-primary" />
     <input   type="button" onclick="resetAll();" class="btn btn-primary" value="清除" /></dt>
    <dd>
       	 	<div id="treeboxbox_tree" style="width:95%;margin-left:10px;overflow:auto;border:0px solid #bdc0c3;"></div>  
       	 	 <span><font size=2 color=red><strong>请在选择要查询的病名后，点击右侧橙色“共通检索”按钮</strong></font></span> 
   </dd>
</dl>
<div class="cont">
	<form  id="searchform" name="searchform" method="post">  
	<div class="sear_tab">
            <div class="tab">
                <span <%if("1".equals(dbtype)){ %>class="curr"<%} %>><i><a href="javaScript:modchnSearch('<%=basePath %>','','');" style="TEXT-DECORATION:none;">中文期刊文献库</a></i></span>
                <span <%if("2".equals(dbtype)){ %>class="curr"<%} %>><i><a href="javaScript:modengSearch('<%=basePath %>','','');" style="TEXT-DECORATION:none;">英文期刊文献库</a></i></span>
                <span <%if("3".equals(dbtype)){ %>class="curr"<%} %>><i><a href="javaScript:oldSearch('<%=basePath %>','','');" style="TEXT-DECORATION:none;">古籍文献库</a></i></span>
                <span <%if("4".equals(dbtype)){ %>class="curr"<%} %>><i><a href="javaScript:summSearch('<%=basePath %>','','');" style="TEXT-DECORATION:none;">综述数据库</a></i></span>
            </div>
           <table id="txt"   border="0" cellpadding="0" cellspacing="0" style="display:<%if("1".equals(dbtype)){ %>block<%}else{%>none<%}%>">
            <input id="txt_i" value="1" type="hidden" name="txt_i">
            <input id="txt_c" value="19" type="hidden" name="txt_c">
            <tbody> 
             <tr id="hidden_logical_txt" style="display:none">
                <td nowrap="true" >
                    <select id="{key}_logical" name="{key}_logical" style="display:none">
                        <option value="0" selected="">并且</option>
                        <option value="1">或者</option>
                    </select>
                </td> 
            </tr>
         
             <tr id="txt_1" >
                 <td nowrap="true" style="padding-left:100px;width:15%"> 
                    <span class="btn_group">
                    	<input type="button" class="add" onclick="AddRowEx('txt','txt_i','txt_c');"/>
                    	<input type="button" class="delete" onclick="DeleteRow('txt','txt_i','txt_c');"/>
                    </span>
                      </td>
                    <td  style="padding-left:5px;">
                    <select id="txt_1_sel" name="txt_1_sel" >
                        <option value="TITLE">             标题        </option>
						<option value="PERIODICALNAME">    刊名            </option>
						<option value="AUTHOR">            作者            </option>
						<option value="AUTHORUNIT">        第一作者单位    </option>
						<option value="AUTHORADDRESS">     第一作者通讯地址</option>
						<option value="KEYWORD">           关键词      </option>
						<option value="SUBJECTWORD">       主题词      </option>
						<option value="ABSTRACT">          摘要        </option>
						<option value="DOCUMENTTYPE">      文献类型        </option>
						<option value="CLASSNO">           分类号          </option>
						<option value="FUNDSTR">           资助情况        </option>
						<option value="FUNDTYPE">          资助类别        </option>
						<option value="FUNDNAME">          基金            </option> 
                    </select>
                    <input   value="" id="txt_1_value" name="txt_1_value" size="10" maxlength="120" type="text"  onkeyup="test(this.id);"     style="width:60%;"/>
                     <select id="txt_1_special" name="txt_1_special" onchange="">
                        <option value="1" selected>模糊</option>
                        <option value="0" >精确</option>
                    </select>
                </td>  
            </tr> 
            <tr>
                <td class="searButt" align=right colspan=2>
                    &nbsp;&nbsp;<input type="button" class="btn btn-primary" onclick="modchnSearch('<%=basePath %>','','');" value=" 检 索 "/>&nbsp;
                    &nbsp;&nbsp;<input type="button" class="btn btn-primary" onclick="resetAllInput();" value=" 清 除 "/>
                    &nbsp;&nbsp;<input type="button" class="btn" onclick="returnIndex();" value=" 返回首页 "/>
                </td>
            </tr>
        </tbody>
      </table>
      
      <table id="modeng"   border="0" cellpadding="0" cellspacing="0" style="display:<%if("2".equals(dbtype)){ %>block<%}else{%>none<%}%>">
            <input id="modeng_i" value="1" type="hidden" name="modeng_i">
            <input id="modeng_c" value="19" type="hidden" name="modeng_c">
            <tbody> 
             <tr id="hidden_logical_modeng" style="display:none">
                <td nowrap="true" >
                    <select id="{key}_logical" name="{key}_logical" style="display:none">
                        <option value="0" selected="">并且</option>
                        <option value="1">或者</option>
                    </select>
                </td> 
            </tr>
         
             <tr id="modeng_1" >
                 <td nowrap="true" style="padding-left:100px;width:15%"> 
                    <span class="btn_group">
                    	<input type="button" class="add" onclick="AddRowEx('modeng','modeng_i','modeng_c');"/>
                    	<input type="button" class="delete" onclick="DeleteRow('modeng','modeng_i','modeng_c');"/>
                    </span>
                      </td>
                    <td  style="padding-left:5px;">
                    <select id="modeng_1_sel" name="modeng_1_sel" >
                        <option value="TITLE">             标题        </option>
						<option value="PERIODICALNAME">    刊名            </option>
						<option value="AUTHOR">            作者            </option>
						<option value="AUTHORUNIT">        第一作者单位    </option>
						<option value="AUTHORADDRESS">     第一作者通讯地址</option>
						<option value="KEYWORD">           关键词      </option>
						<option value="SUBJECTWORD">       主题词      </option>
						<option value="ABSTRACT">          摘要        </option>
						<option value="DOCUMENTTYPE">      文献类型        </option>
						<option value="CLASSNO">           分类号          </option>
						<option value="FUNDSTR">           资助情况        </option>
						<option value="FUNDTYPE">          资助类别        </option>
						<option value="FUNDNAME">          基金            </option>
                    </select>
                    <input   value="" id="modeng_1_value" name="modeng_1_value" size="10" maxlength="120" type="text"  onkeyup="test(this.id);"     style="width:60%;"/>
                     <select id="modeng_1_special" name="modeng_1_special" onchange="">
                        <option value="1" selected>模糊</option>
                        <option value="0" >精确</option>
                    </select>
                </td>  
            </tr> 
            <tr>
                <td class="searButt" align=right colspan=2>
                    &nbsp;&nbsp;<input type="button" class="btn btn-primary" onclick="modengSearch('<%=basePath %>','','');" value=" 检 索 "/>&nbsp;
                    &nbsp;&nbsp;<input type="button" class="btn btn-primary" onclick="resetAllInput();" value=" 清 除 "/>
                    &nbsp;&nbsp;<input type="button" class="btn" onclick="returnIndex();" value=" 返回首页 "/>
                </td>
            </tr>
        </tbody>
      </table>
      
      <table id="old"   border="0" cellpadding="0" cellspacing="0" style="display:<%if("3".equals(dbtype)){ %>block<%}else{%>none<%}%>">
            <input id="old_i" value="1" type="hidden" name="old_i">
            <input id="old_c" value="19" type="hidden" name="old_c">
            <tbody> 
             <tr id="hidden_logical_old" style="display:none">
                <td nowrap="true" >
                    <select id="{key}_logical" name="{key}_logical" style="display:none">
                        <option value="0" selected="">并且</option>
                        <option value="1">或者</option>
                    </select>
                </td> 
            </tr> 
             <tr id="old_1" >
                 <td nowrap="true" style="padding-left:100px;width:15%"> 
                    <span class="btn_group">
                    	<input type="button" class="add" onclick="AddRowEx('old','old_i','old_c');"/>
                    	<input type="button" class="delete" onclick="DeleteRow('old','old_i','old_c');"/>
                    </span>
                      </td>
                    <td  style="padding-left:5px;">
                    <select id="old_1_sel" name="old_1_sel" >
                     
						<option value="BOOKNAME">          书籍名称        </option>
						<option value="AUTHOR">            著者            </option>
						<option value="BOOKCD">            朝代            </option>
						<option value="TCMNAME">           中医病名        </option>
						<option value="VOLUMESECTION">     卷册章节        </option>
						<option value="ORIGINALTEXT">      古籍原文      </option>
                    </select>
                    <input   value="" id="old_1_value" name="old_1_value" size="10" maxlength="120" type="text"  onkeyup="test(this.id);"     style="width:60%;"/>
                     <select id="old_1_special" name="old_1_special" onchange="">
                        <option value="1" selected>模糊</option>
                        <option value="0" >精确</option>
                    </select>
                </td>  
            </tr> 
            <tr>
                <td class="searButt" align=right colspan=2>
                    &nbsp;&nbsp;<input type="button" class="btn btn-primary" onclick="oldSearch('<%=basePath %>','','');" value=" 检 索 "/>&nbsp;
                    &nbsp;&nbsp;<input type="button" class="btn btn-primary" onclick="resetAllInput();" value=" 清 除 "/>
                    &nbsp;&nbsp;<input type="button" class="btn" onclick="returnIndex();" value=" 返回首页 "/>
                </td>
            </tr>
        </tbody>
      </table>
      <table id="summ"   border="0" cellpadding="0" cellspacing="0" style="display:<%if("4".equals(dbtype)){ %>block<%}else{%>none<%}%>">
         <tr id="summ_1" >
                 <td nowrap="true" style="padding-left:100px;width:15%"> 
                       请输入检索词
                      </td>
                    <td  style="padding-left:5px;"> 
                    <input   value="" id="summ_value" name="summ_value" size="10" maxlength="120" type="text"  onkeyup="test(this.id);"     style="width:60%;"/>
                     <select id="summ_special" name="summ_special" onchange="">
                        <option value="1" selected>模糊</option>
                        <option value="0" >精确</option>
                    </select>
                </td>  
            </tr> 
            <tr>
                <td class="searButt" align=right colspan=2>
                    &nbsp;&nbsp;<input type="button" class="btn btn-primary" onclick="summSearch('<%=basePath %>','','');" value=" 检 索 "/>&nbsp;
                    &nbsp;&nbsp;<input type="button" class="btn btn-primary" onclick="resetAllInput();" value=" 清 除 "/>
                    &nbsp;&nbsp;<input type="button" class="btn" onclick="returnIndex();" value=" 返回首页 "/>
                </td>
            </tr> 
     </table>
        
      </div>
      </form><!--/检索-->
    <!--检索结果-->
    <div class="iframeWrap">
        <iframe src="<%=basePath %>search/modchnsearch.do" id="resultlist" frameborder="0" style="width:100%;" class="iframeStyle"></iframe>
    </div>
  <!--/检索结果-->
</div>
</body>
</html> 
<script> 
var tagtype = "";
//获得所有被选中的选项
function getAllselectedId() {  
    var selectedList = tree.getAllChecked();  
    return selectedList;
    
}
//清除所有被选中的选项
function clearAllSelectedItem(){
      
	   tree.refreshItem(tagtype);
    //tree.clearSelection();
}
function submitSearch(){ 
   window.parent.searchresult.submitSearchForm();
}
function tonclick(itemId) {
     var ischeck = tree.isItemChecked(itemId) 
     if('0' == ischeck){
     	tree.setCheck(itemId,1);
     	 //window.open ('<%=basePath%>app/search/synnames.jsp?id='+itemId, 'syn', 'alwaysRaised=yes,z-look=yes,height=300, width=500, top=0,left=0, toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, status=no')
     	      	showLayer(itemId) ; 
     	
     }
     if('1' == ischeck)
     	tree.setCheck(itemId,0);  
     	//loadSynnames(itemId);
     	//loadnames(itemId);

};
function tondblclick(itemId) {
         var ischeck = tree.isItemChecked(itemId);
     if('0' == ischeck){
     	tree.setCheck(itemId,1);
     	//window.open ('<%=basePath%>app/search/synnames.jsp?id='+itemId, 'syn', 'alwaysRaised=yes,z-look=yes,height=300, width=500, top=0,left=0, toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, status=no')
     	showLayer(itemId) ;
     	
     }
     if('1' == ischeck)
     	tree.setCheck(itemId,0); 
     	
};
function toncheck(itemId) {
       
      
};

function showLayer(itemid){
  $.layer({ 
	type : 2,
	shade : [0],
    fix: false,
	title : ['古今中医同义词、西医同义词表',true],
	iframe : {src : '<%=basePath%>app/search/synnames.jsp?id='+itemid},
	area : ['500px' , '450px'],
	offset : ['150px', ''],
	success: function(){
		 layer.shift('left-bottom',1000); //浏览器右下角弹出
	},
	close : function(index){
 		layer.close(index);
	}
});
  
}


/**function tonclick(itemId) {
     tree.setCheck(itemId,1);
};
function tondblclick(itemId) {
      tree.setCheck(itemId,1);
};
function toncheck(itemId) {
     tree.setCheck(itemId,1);
};
*/
function tonopen(id, mode) {
    return confirm("Do you want to " + (mode > 0 ? "close": "open") + " node " + tree.getItemText(id) + "?");
}; 

function doOnLoad() {
   //tree
tree = new dhtmlXTreeObject("treeboxbox_tree", "100%", "97%", 0);
tree.enableTreeLines(true);
tree.enableCheckBoxes(true);
//tree.setSkin('dhx_skyblue');
tree.setImagePath("<%=basePath %>thirtpart/dhtmlx25/imgs/csh_winstyle/");
tree.enableDragAndDrop(0);
tree.enableTreeLines(true);
//tree.setImageArrays("plus", "", "", "", "plus.gif");
//tree.setImageArrays("minus", "", "", "", "minus.gif");
//tree.setStdImages("book.gif", "books_open.gif", "books_close.gif");
//tree.setImageArrays("plus", "", "", "", "", "plus.gif");
//tree.setImageArrays("minus", "", "", "", "", "minus.gif");
//tree.setStdImages("book.gif", "folderOpen.gif", "folderClosed.gif");
 
//tree.setOnOpenHandler(tonopen);
//tree.attachEvent("onOpenEnd", function(nodeId, event) {
//    doLog("An id of open item is " + nodeId);
//});
tree.setOnClickHandler(tonclick);
tree.setOnCheckHandler(toncheck);
/**tree.attachEvent("onBeforeCheck", function(id,state){
	var userData = tree.getUserData(id,"tagtype"); 
    if("0" == state ){
	    if("" == tagtype){
	    	tagtype = userData;
	    	return true;
	    }else{
	    	if(tagtype != userData){
	    	   alert("检索主题分类共分为四个主题：病名、方剂、证候、中药，同时只能选择一个主题分类！"); 
	    	   return false;
	    	}else{
	    	   return true;
	    	}
	    } 
    } else{
    	return true;
    }
});
*/
//tree.setOnDblClickHandler(tondblclick);

tree.preventIECaching(true);
//tree.enableSmartXMLParsing(true);//false to disable 
tree.enableDistributedParsing(true,20,50);
//tree.enableSmartXMLParsing(true); 

tree.setXMLAutoLoading("<%=basePath %>search/maintree.do");
// tree.loadXML("<%=basePath %>search/subjecttree.do");
tree.loadXML("<%=basePath %>search/maintree.do");	
	
}
doOnLoad(); 
var divH = window.screen.availHeight*0.70;
document.getElementById("treeboxbox_tree").style.height = divH; 
//alert(document.getElementById("treeboxbox_tree").style.height);
//alert(window.screen.availHeight);
//tree.showItemCheckbox(1, false);
 function resetAll(){
 	clearAllSelectedItem();
 }
 function selectAll(){
     var unchecklist = tree.getAllUnchecked(4);
     
     var idarr = unchecklist.split(","); 
     for(var i =0;i<idarr.length;i++){ 
        tree.setCheck(idarr[i],1);
     }
 
 }
var disidstr = '<%=disidstr%>';
var disarr = disidstr.split(',');

function checkItem(){
  for(var j=0;j<disarr.length;j++){
     tree.setCheck(disarr[j], 1);
  }
}

setTimeout("checkItem()",500);   

<%if("1".equals(dbtype)){ %>
modchnSearch('<%=basePath %>','<%=paramvalue%>','<%=disidstr%>');
<%}%>
<%if("2".equals(dbtype)){ %>
modengSearch('<%=basePath %>','<%=paramvalue%>','<%=disidstr%>');
<%}%>
<%if("3".equals(dbtype)){ %>
oldSearch('<%=basePath %>','<%=paramvalue%>','<%=disidstr%>');
<%}%>
<%if("4".equals(dbtype)){ %>
summSearch('<%=basePath %>','<%=paramvalue%>','<%=disidstr%>');
<%}%> 
	</script>